<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>意无瑕</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="fly,layui,前端社区">
    <meta name="description" content="Fly社区是模块化前端UI框架Layui的官网社区，致力于为web开发提供强劲动力">
    <link rel="stylesheet" th:href="@{/static/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/static/css/global.css}">
</head>
<body>

<div class="fly-header layui-bg-black">
    <div class="layui-container">
        <a class="fly-logo" href="/">
            <img src="images/logo.png" alt="layui">
        </a>

    </div>
</div>

<div class="layui-container fly-marginTop">
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title">
                <li class="layui-this">登入</li>
            </ul>
            <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form layui-form-pane">
                        <form>
                            <div class="layui-form-item">
                                <label for="user-name" class="layui-form-label">用户名:</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="user-name" name="user-name" required lay-verify="required"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="password" class="layui-form-label">密码:</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="password" name="password" required lay-verify="required"
                                           autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <button type="button" class="layui-btn" id="login-submit">立即登录</button>
                                <button type="button" class="layui-btn" id="login-register">立即注册</button>

                                <span style="padding-left:20px;">
                <!--  <a href="forget.html">忘记密码？</a>-->
                </span>
                            </div>
                            <!--<div class="layui-form-item fly-form-app">
                                <span>或者使用社交账号登入</span>
                                <a href="" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-qq" title="QQ登入"></a>
                                <a href="" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})" class="iconfont icon-weibo" title="微博登入"></a>
                            </div>-->
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="fly-footer">
    <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a href="http://www.layui.com/"
</div>

<script src="layui/layui.all.js"></script>
<script>
    ;!function () {
        //无需再执行layui.use()方法加载模块，直接使用即可
        var form = layui.form
            , layer = layui.layer;
        $ = layui.jquery;


        $("#login-submit").on('click', function () {
            var params = {
                userName: $("#user-name").val(),
                passWord: $("#password").val(),
            };
            $.ajax({
                url: '/sys/loginCheck',
                method: 'post',
                data: params,
                dataType: 'JSON',
                success: function (response) {
                    console.log(response);
                    if (response.status==0){
                        layer.msg("登录成功");
                        location.href="/index"
                    }else{
                        layer.msg(response.msg);
                    }
                }
            });
        });
        $("#login-register").on('click',function(){
            layer.open({
                type: 2,
                shade: false,
                fixed: true,
                shade: 0.5,
                title: '用户注册',
                moveType: 1 ,
                skin: 'layui-layer-rim', //加上边框
                area: ['350px', '250px'], //宽高
                content: '/login/register',
               // zIndex: layer.zIndex, //重点1
            });
        });

    }();
</script>
</body>
</html>